package com.tomecode.rvr.generator.formate;

import java.util.Date;

import org.tmatesoft.svn.core.SVNNodeKind;
import org.tmatesoft.svn.core.wc.SVNStatusType;

import com.tomecode.rvr.generator.util.Utilities;

/**
 * 
 * Current line - contains all data in line
 * 
 * @author Frastia Tomas
 * 
 */
final class Line {

	/**
	 * svn kind
	 */
	private final String kind;
	/**
	 * svn author
	 */
	private final String author;
	/**
	 * svn status
	 */
	private final String status;
	/**
	 * svn revision date
	 */
	private final String revisionDate;
	/**
	 * svn commited date
	 */
	private final String commitedDate;
	/**
	 * svn revision number
	 */
	private final String revisionNumber;
	/**
	 * svn path
	 */
	private final String path;

	/**
	 * Construktor
	 * 
	 * @param svnNodeKind
	 *            {@link #kind}
	 * @param author
	 *            if null or empty then the {@link #author} will have a value of
	 *            "unknown"
	 * @param svnStatusType
	 *            if null or empty then the {@link #status} will have a value of
	 *            "unknown"
	 * @param revisionNumber
	 * @param revisionDate
	 * @param commitedDate
	 * @param path
	 */
	public Line(SVNNodeKind svnNodeKind, String author, SVNStatusType svnStatusType, long revisionNumber, Date revisionDate, Date commitedDate, String path) {
		this.kind = svnNodeKind.toString();
		this.author = Utilities.isEmpty(author) ? "unknow" : author;
		this.status = (svnStatusType == null) ? "unknow" : String.valueOf(svnStatusType.getCode());
		this.revisionDate = Utilities.formateDate(revisionDate);
		this.revisionNumber = String.valueOf(revisionNumber);
		this.commitedDate = Utilities.formateDate(commitedDate);
		this.path = path;
	}

	/**
	 * get {@link #kind}
	 * 
	 * @return
	 */
	public final String getKind() {
		return kind;
	}

	/**
	 * get {@link #author}
	 * 
	 * @return
	 */
	public final String getAuthor() {
		return author;
	}

	/**
	 * get {@link #status}
	 * 
	 * @return
	 */
	public final String getStatus() {
		return status;
	}

	/**
	 * get {@link #revisionDate}
	 * 
	 * @return
	 */
	public final String getRevisionDate() {
		return revisionDate;
	}

	/**
	 * get {@link #commitedDate}
	 * 
	 * @return
	 */
	public final String getCommitedDate() {
		return commitedDate;
	}

	/**
	 * get {@link #path}
	 * 
	 * @return
	 */
	public final String getPath() {
		return path;
	}

	/**
	 * get {@link #revisionNumber}
	 * 
	 * @return
	 */
	public final String getRevisionNumber() {
		return revisionNumber;
	}

}